3.396 \(\int x \cos (2 x) \sec ^2(x) \, dx\)

Optimal. Leaf size=14 \[ x^2-x \tan (x)-\log (\cos (x)) \]

[Out]

x^2-ln(cos(x))-x*tan(x)

________________________________________________________________________________________

Rubi [A]  time = 0.03, antiderivative size = 14, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.400, Rules used = {4431, 3720, 3475, 30} \[ x^2-x \tan (x)-\log (\cos (x)) \]

Antiderivative was successfully verified.

[In]

Int[x*Cos[2*x]*Sec[x]^2,x]

[Out]

x^2 - Log[Cos[x]] - x*Tan[x]

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3720

Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*(c + d*x)^m*(b*Tan[e
 + f*x])^(n - 1))/(f*(n - 1)), x] + (-Dist[(b*d*m)/(f*(n - 1)), Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1)
, x], x] - Dist[b^2, Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n,
1] && GtQ[m, 0]

Rule 4431

Int[((e_.) + (f_.)*(x_))^(m_.)*(F_)[(a_.) + (b_.)*(x_)]^(p_.)*(G_)[(c_.) + (d_.)*(x_)]^(q_.), x_Symbol] :> Int
[ExpandTrigExpand[(e + f*x)^m*G[c + d*x]^q, F, c + d*x, p, b/d, x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && M
emberQ[{Sin, Cos}, F] && MemberQ[{Sec, Csc}, G] && IGtQ[p, 0] && IGtQ[q, 0] && EqQ[b*c - a*d, 0] && IGtQ[b/d,
1]

Rubi steps

\begin {align*} \int x \cos (2 x) \sec ^2(x) \, dx &=\int \left (x-x \tan ^2(x)\right ) \, dx\\ &=\frac {x^2}{2}-\int x \tan ^2(x) \, dx\\ &=\frac {x^2}{2}-x \tan (x)+\int x \, dx+\int \tan (x) \, dx\\ &=x^2-\log (\cos (x))-x \tan (x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.02, size = 14, normalized size = 1.00 \[ x^2-x \tan (x)-\log (\cos (x)) \]

Antiderivative was successfully verified.

[In]

Integrate[x*Cos[2*x]*Sec[x]^2,x]

[Out]

x^2 - Log[Cos[x]] - x*Tan[x]

________________________________________________________________________________________

fricas [A]  time = 0.56, size = 26, normalized size = 1.86 \[ \frac {x^{2} \cos \relax (x) - \cos \relax (x) \log \left (-\cos \relax (x)\right ) - x \sin \relax (x)}{\cos \relax (x)} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cos(2*x)*sec(x)^2,x, algorithm="fricas")

[Out]

(x^2*cos(x) - cos(x)*log(-cos(x)) - x*sin(x))/cos(x)

________________________________________________________________________________________

giac [B]  time = 1.55, size = 118, normalized size = 8.43 \[ \frac {2 \, x^{2} \tan \left (\frac {1}{2} \, x\right )^{2} - \log \left (\frac {4 \, {\left (\tan \left (\frac {1}{2} \, x\right )^{4} - 2 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 1\right )}}{\tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right ) \tan \left (\frac {1}{2} \, x\right )^{2} - 2 \, x^{2} + 4 \, x \tan \left (\frac {1}{2} \, x\right ) + \log \left (\frac {4 \, {\left (\tan \left (\frac {1}{2} \, x\right )^{4} - 2 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 1\right )}}{\tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right )}{2 \, {\left (\tan \left (\frac {1}{2} \, x\right )^{2} - 1\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cos(2*x)*sec(x)^2,x, algorithm="giac")

[Out]

1/2*(2*x^2*tan(1/2*x)^2 - log(4*(tan(1/2*x)^4 - 2*tan(1/2*x)^2 + 1)/(tan(1/2*x)^4 + 2*tan(1/2*x)^2 + 1))*tan(1
/2*x)^2 - 2*x^2 + 4*x*tan(1/2*x) + log(4*(tan(1/2*x)^4 - 2*tan(1/2*x)^2 + 1)/(tan(1/2*x)^4 + 2*tan(1/2*x)^2 +
1)))/(tan(1/2*x)^2 - 1)

________________________________________________________________________________________

maple [A]  time = 0.06, size = 15, normalized size = 1.07 \[ x^{2}-\ln \left (\cos \relax (x )\right )-x \tan \relax (x ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*cos(2*x)*sec(x)^2,x)

[Out]

x^2-ln(cos(x))-x*tan(x)

________________________________________________________________________________________

maxima [B]  time = 0.42, size = 111, normalized size = 7.93 \[ \frac {2 \, x^{2} \cos \left (2 \, x\right )^{2} + 2 \, x^{2} \sin \left (2 \, x\right )^{2} + 4 \, x^{2} \cos \left (2 \, x\right ) + 2 \, x^{2} - {\left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right )} \log \left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right ) - 4 \, x \sin \left (2 \, x\right )}{2 \, {\left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cos(2*x)*sec(x)^2,x, algorithm="maxima")

[Out]

1/2*(2*x^2*cos(2*x)^2 + 2*x^2*sin(2*x)^2 + 4*x^2*cos(2*x) + 2*x^2 - (cos(2*x)^2 + sin(2*x)^2 + 2*cos(2*x) + 1)
*log(cos(2*x)^2 + sin(2*x)^2 + 2*cos(2*x) + 1) - 4*x*sin(2*x))/(cos(2*x)^2 + sin(2*x)^2 + 2*cos(2*x) + 1)

________________________________________________________________________________________

mupad [B]  time = 2.35, size = 31, normalized size = 2.21 \[ x^2-\ln \left ({\mathrm {e}}^{x\,2{}\mathrm {i}}+1\right )+x\,2{}\mathrm {i}-\frac {x\,2{}\mathrm {i}}{{\mathrm {e}}^{x\,2{}\mathrm {i}}+1} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x*cos(2*x))/cos(x)^2,x)

[Out]

x*2i - log(exp(x*2i) + 1) - (x*2i)/(exp(x*2i) + 1) + x^2

________________________________________________________________________________________

sympy [B]  time = 5.74, size = 144, normalized size = 10.29 \[ x^{2} + \frac {2 x \tan {\left (\frac {x}{2} \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} - 1} - \frac {\log {\left (\tan {\left (\frac {x}{2} \right )} - 1 \right )} \tan ^{2}{\left (\frac {x}{2} \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} - 1} + \frac {\log {\left (\tan {\left (\frac {x}{2} \right )} - 1 \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} - 1} - \frac {\log {\left (\tan {\left (\frac {x}{2} \right )} + 1 \right )} \tan ^{2}{\left (\frac {x}{2} \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} - 1} + \frac {\log {\left (\tan {\left (\frac {x}{2} \right )} + 1 \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} - 1} + \frac {\log {\left (\tan ^{2}{\left (\frac {x}{2} \right )} + 1 \right )} \tan ^{2}{\left (\frac {x}{2} \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} - 1} - \frac {\log {\left (\tan ^{2}{\left (\frac {x}{2} \right )} + 1 \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} - 1} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cos(2*x)*sec(x)**2,x)

[Out]

x**2 + 2*x*tan(x/2)/(tan(x/2)**2 - 1) - log(tan(x/2) - 1)*tan(x/2)**2/(tan(x/2)**2 - 1) + log(tan(x/2) - 1)/(t
an(x/2)**2 - 1) - log(tan(x/2) + 1)*tan(x/2)**2/(tan(x/2)**2 - 1) + log(tan(x/2) + 1)/(tan(x/2)**2 - 1) + log(
tan(x/2)**2 + 1)*tan(x/2)**2/(tan(x/2)**2 - 1) - log(tan(x/2)**2 + 1)/(tan(x/2)**2 - 1)

________________________________________________________________________________________